#pragma once

#include <vgraph>
#include "EventArgs.h"

struct CaretChangedEventArgs : public EventArgs_flag 
{
public:
	enum{CARET_VISIBLE = 0x01,CARET_DESROTY = 0x02,CARET_CREATE = 0x04,POSITION = 0x08};
	static CaretChangedEventArgs BeingDestoryed() {CaretChangedEventArgs args;args.visible = false;args.flag |= CARET_DESROTY;return args;}
	static CaretChangedEventArgs VisibleChanged(bool visible=true){CaretChangedEventArgs args;args.visible = visible;args.flag |= CARET_VISIBLE;return args;}
	static CaretChangedEventArgs SizeChanged(const Point& abovePoint,const Point& belowPoint) {CaretChangedEventArgs args;args.abovePoint = abovePoint; args.belowPoint = belowPoint;args.flag |= CARET_CREATE;return args;}
	static CaretChangedEventArgs PositionChanged(const Point& position) {CaretChangedEventArgs args;args.position = position; args.flag |= POSITION;return args;}

	bool IsVisible() const {return visible;}
	Rect GetCaretSize() const {return Rect(abovePoint,belowPoint);}
	const Point& GetPosition() const {return position;}

protected:
	CaretChangedEventArgs() {}
	bool visible;
	Point abovePoint;
	Point belowPoint;
	Point position;
};